# -*-  coding: UTF-8  -*-
import threading
import time
import wx

class wxWindowRaiserThread(threading.Thread) :

    def __init__(self, window, bStayVisible = False) :
        threading.Thread.__init__(self)
        self.window       = window
        self.bStayVisible = bStayVisible
        self.pause        = 5.0

    def run(self) :
        screenWidth  = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X)
        screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
        wndSize      = self.window.GetSize()
        x            = screenWidth - wndSize.GetWidth()
        y            = screenHeight
        self.window.MoveXY(x, y)
        self.window.Show()
        for y in range(wndSize.GetHeight()) :
            time.sleep(0.01)
            self.window.MoveXY(x, screenHeight - y)

        if not self.bStayVisible :
            time.sleep(self.pause)
            for y in range(wndSize.GetHeight(), 0, -1) :
                time.sleep(0.01)
                self.window.MoveXY(x, screenHeight - y)

            self.window.Hide()
        return 0;
